﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
//using SignInServices.Entities;
using SignInServices.Code;
using SignInServices.Common;
using System.Collections;

namespace SignInServices.Service
{
    [ServiceKnownType(typeof(PasswordResetResultType))]
    [ServiceKnownType(typeof(IList))]
    [ServiceKnownType(typeof(SSOUserAlreadyExistsException))]
    [ServiceKnownType(typeof(SSOUserDoesNotExistException))]
    [ServiceKnownType(typeof(SSOInvalidPasswordException))]
    [ServiceKnownType(typeof(AuthenticatedUser))]
    [ServiceContract]
    
    public interface ISSO
    {
        [OperationContract]
        [FaultContract(typeof(SSOUserAlreadyExistsException))]
        void CreateUser(string userName, string password, string eMail, bool isActive);
        [OperationContract]
        void DeleteUser(string userName);

        [OperationContract]
        bool UserExists(string userName);

        [OperationContract]
        bool ChangePassword(string userName, string oldPaassword, string newPassword);

        [OperationContract]
        IList<AuthenticatedUser> GetUsers(int index, int count);

        [OperationContract]
        [FaultContract(typeof(SSOUserDoesNotExistException))]
        AuthenticatedUser GetUserByName(string userName);


        [OperationContract]
        [FaultContract(typeof(SSOUserDoesNotExistException))]
        AuthenticatedUser GetUserByEmail(string emailAddress);

        [OperationContract]
        [FaultContract(typeof(SSOUserDoesNotExistException))]
        AuthenticatedUser GetUserByID(int id);


        [OperationContract]
        List<AuthenticatedUser> FindUsersByEmail(string EmailAddress);

        [OperationContract]
        List<AuthenticatedUser> FindUsersByName(string UserName);

        [OperationContract]
        [FaultContract(typeof(SSOInvalidPasswordException))]
        [FaultContract(typeof(SSOUserDoesNotExistException))]
        bool SignIn(string userName, string password);

        [OperationContract]
        void SignOut(string userName);

        [OperationContract]
        bool IsAuthenticated(string userName);

        [OperationContract]
        PasswordResetResultType ResetPassword(string emailAddress);

        [OperationContract]
        int GetOnlineCount();

        [OperationContract]
        void UpdateUser(string userName, string password, string eMail, bool isActive);
    }
}
